<template>
  <button
    class="cl-button"
    :class="{
      [`cl-button--${type}`]: type,
      [`cl-button--${size}`]: size,
      'is-plain': plain,
      'is-round': round,
      'is-circle': circle,
      'is-disabled': disabled
    }"
    :disabled="disabled || loading"
    :autofocus="autofocus"
    :type="nativeType">
    <Icon icon="spinner" spin v-if="loading" />
    <Icon :icon="icon" v-if="icon" />
    <span><slot></slot></span>
  </button>
</template>

<script lang="ts" setup>
// import './style.css'
import type { ButtonProps } from './types'
import Icon from '../Icon/Icon.vue'
defineOptions({ name: 'cl-button' })

withDefaults(defineProps<ButtonProps>(), { nativeType: 'button' })
</script>
